# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models


class bgyp(models.Model):
    name = models.CharField(max_length=128)
    bgClass_choice = models.CharField(max_length=128,choices=(('zmyp','桌面用品'),('sxwj','书写文具'),('bgyz','办公用纸'),('wjcx','文件储蓄'),('qtyp','其他用品')))
    price = models.CharField(max_length=128)
    remarks = models.CharField(max_length=256,null=True)

    class Meta:
        managed = True
        db_table = "bgyp"
    def __str__(self):
        return '品类名：%s\t种类：%s\t价格：%s\t备注：%s' % (self.name, self.bgClass_choice, self.price, self.remarks)

class kucun(models.Model):
    name = models.ForeignKey(bgyp,on_delete=models.CASCADE,related_name='kc_name',null=True)
    num = models.CharField(max_length=128)
    time = models.CharField(max_length=128)
    person = models.CharField(max_length=128)
    remarks = models.CharField(max_length=256,null=True)

    class Meta:
        managed = True
        db_table = "kucun"

    def __str__(self):
        return '品类名：%s\t数量：%s\t入库时间：%s\t负责人：%s\t备注：%s' % (self.name, self.num, self.time, self.person, self.remarks)

class lingyonglog(models.Model):
    name = models.ForeignKey(bgyp,on_delete=models.CASCADE,related_name='ly_name',null=True)
    num = models.CharField(max_length=128)
    time = models.CharField(max_length=128)
    person = models.CharField(max_length=128)
    person2 = models.CharField(max_length=128)
    remarks = models.CharField(max_length=256,null=True)

    class Meta:
        managed = True
        db_table = "lingyonglog"

    def __str__(self):
        return '品类名：%s\t数量：%s\t领用人：%s\t领用时间：%s\t负责人：%s\t备注：%s' % (self.name, self.num, self.person, self.time, self.person2, self.remarks)